1

00:00:00,098  -->  00:00:09,404
In this video, we are going to learn about decode.
Here in the line 21, we have decode script.

2

00:00:10,116  -->  00:00:18,080
I said before, that the data type of
output is byte, and if we print the byte,

3

00:00:18,080  -->  00:00:23,936
the output is not good, this
is why we use decode here.

4

00:00:24,916  -->  00:00:28,516
So this decode is used to convert

5

00:00:28,516  -->  00:00:35,794
from byte to string. Let’s try to remove
this decode and see what happened.

6

00:00:36,632  -->  00:00:45,599
Let’s change the loopback to loopback3,
and the ip address is 10.1.1.4. save,

7

00:00:46,516  -->  00:00:56,350
Let’s run the script, clear, and
then python paramiko_basic.py,

8

00:00:58,010  -->  00:01:06,470
Just enter here, the username also just
enter, and the password, also just enter.

9

00:01:07,414  -->  00:01:13,512
Here we can see that we are success login
to router 1, and we also success to send

10

00:01:13,512  -->  00:01:24,666
the configuration, but here we can see b, this is
means byte. And the output is not good like this.

11

00:01:25,423  -->  00:01:30,781
But the command is sent to
the router 1. Let’s check it.

12

00:01:32,498  -->  00:01:36,425
Show ip interface brief exclude unassign.

13

00:01:37,680  -->  00:01:40,398
Here we can see that we have loopback3,

14

00:01:40,712  -->  00:01:48,932
and the ip address is 10.1.1.4, this is
the loopback interface that we just create.

15

00:01:49,850  -->  00:01:58,364
Okay, so once again, the data type of output
is byte, we also can print the data type,

16

00:01:59,547  -->  00:02:03,350
here let’s print type and then output.

17

00:02:04,240  -->  00:02:04,910
Save,

18

00:02:08,632  -->  00:02:17,136
Let’s run the script again, python3
paramiko_basic.py, just enter enter here.

19

00:02:18,000  -->  00:02:21,204
Here we can see that the data type is byte.

20

00:02:22,054  -->  00:02:30,150
Now let’s put the decode again. Remember that
decode is used to convert byte to string.

21

00:02:31,601  -->  00:02:40,247
Save, back to terminal, and run the
script again, just enter enter here.

22

00:02:42,463  -->  00:02:46,639
Here we can see that now the data type is string.

23

00:02:47,236  -->  00:02:49,743
And now the output is good.

24

00:02:50,623  -->  00:02:54,301
Okay I hope you understand the function of decode.

25

00:02:54,729  -->  00:02:57,043
I think enough for this video

26

00:02:57,432  -->  00:03:01,114
Thank you for watching and see you on the next video.
